//
//  MessagesV2.swift
//  imprint
//
//  Created by 小柠檬🍋 on 2025/3/11.
//

class ChatMessageBean: Codable {
    var name: String? = nil
    var content: String? = nil
    var desc: String? = nil
    var time: String? = nil
    var role: String? = nil
    var target_id: String? = nil //引用id
    var reply_content: String? = nil //回复内容
    var quote_reply: Quote? = nil //引用回复json
    var suffix: String? = nil//(可选后缀，如“的脑袋”)，拍一拍
    var action: String? = nil//拍了拍，动作
    var type: String? = nil//
}

// 引用回复子模型
extension ChatMessageBean {
    struct Quote: Codable {
        var target_id: String? = nil //引用id
        var target_sender: String? = nil //引用人
        var target_content: String? = nil //引用内容
        var reply_content: String? = nil //回复内容
    }
}

// 拍一拍子模型
extension ChatMessageBean {
    struct Pat: Codable {
        var userId: String? = nil //目标用户id
        var userName: String? = nil //目标人
        var roleType: Int? = nil //目标是用户还是AI
        var action: String? = nil //动作-拍一拍，摇一摇
        var suffix: String? = nil //(可选后缀，如“的脑袋”)，拍一拍
        var content: String? = nil
        
        // 判断是否为AI
        func isBot() -> Bool {
            return roleType ?? 0 == IRoleType.BOT.rawValue
        }
        
        // 判断是否为用户
        func isUser() -> Bool {
            return roleType ?? 0 == IRoleType.USER.rawValue
        }
    }
}
